package com.app.designpatternslearn.structured.filterpattern.code

import java.text.SimpleDateFormat

class TimeFilterBook : FilterBook {

    override fun filter(books: MutableList<Book>): MutableList<Book> {

        val newBooks = mutableListOf<Book>()

        val dateFormat = SimpleDateFormat("yyyy-mm-dd HH-mm-ss")
        //归还日期
        val date = dateFormat.parse("2018-11-22 15-32-50")

        for (item in books) {
            if (item.time >= date.time) {
                newBooks.add(item)
            }
        }
        return newBooks
    }

}